package com.toefl.speaking.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;

import com.toefl.speaking.R;
import com.toefl.speaking.activity.base.BaseActivity;

public class HomeActivity extends BaseActivity {

	private ImageView select_question1, select_question2, select_question3, select_question4, select_question5,
			select_question6;

	public void onCreate(Bundle savedInstanceState) {
		super.context = HomeActivity.this;
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.home);
		MyListener myListener = new MyListener();
		select_question1 = (ImageView) findViewById(R.id.select_question1);
		select_question2 = (ImageView) findViewById(R.id.select_question2);
		select_question3 = (ImageView) findViewById(R.id.select_question3);
		select_question4 = (ImageView) findViewById(R.id.select_question4);
		select_question5 = (ImageView) findViewById(R.id.select_question5);
		select_question6 = (ImageView) findViewById(R.id.select_question6);
		select_question1.setOnClickListener(myListener);
		select_question2.setOnClickListener(myListener);
		select_question3.setOnClickListener(myListener);
		select_question4.setOnClickListener(myListener);
		select_question5.setOnClickListener(myListener);
		select_question6.setOnClickListener(myListener);
	}

	@Override
	protected void initUI() {

		super.initUI();
	}

	public class MyListener implements OnClickListener {

		@Override
		public void onClick(View v) {

			Intent intent = new Intent();
			int questionType = 0;
			switch (v.getId()) {
			case R.id.select_question1:
				questionType = 1;
				break;
			case R.id.select_question2:
				questionType = 2;
				break;
			case R.id.select_question3:
				questionType = 3;
				break;
			case R.id.select_question4:
				questionType = 4;
				break;
			case R.id.select_question5:
				questionType = 5;
				break;
			case R.id.select_question6:
				questionType = 6;
				break;
			}
			intent.putExtra("question_type", questionType);
			// HomeActivity.this.finish();
			MainActivity.switchActivity(QuestionListActivity.class, intent);

		}

	};

}
